package com.weyoung.app.controller;

import com.weyoung.app.common.convention.result.Result;
import com.weyoung.app.pojo.dto.CaloriesDTO;
import com.weyoung.app.pojo.dto.HeartDTO;
import com.weyoung.app.pojo.dto.StepsDTO;
import com.weyoung.app.service.HealthDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/message")
public class HealthDateController {


    @Autowired
    HealthDataService healthDataService;

    /**
     * 查询当天的卡路里数据
     * @return
     */
    @GetMapping("/calories/day")
    public Result<CaloriesDTO> getCaloriesDay() {
        CaloriesDTO caloriesDTO = healthDataService.getCaloriesDay();
        return Result.success(caloriesDTO);
    }

    /**
     * 查询一周的卡路里数据
     */
    @GetMapping("/calories/weekend")
    public Result<CaloriesDTO> getCaloriesWeekend() {
        CaloriesDTO caloriesDTO = healthDataService.getCaloriesWeekend();
        return Result.success(caloriesDTO);
    }
    /**
     * 查询本月卡路里
     */
    @GetMapping("/calories/month")
    public Result<CaloriesDTO> getCaloriesMonth() {
        CaloriesDTO caloriesDTO = healthDataService.getCaloriesMonth();
        return Result.success(caloriesDTO);
    }


    /**
     *查询日步数
     */
    @GetMapping("/steps/day")
    public Result<List<StepsDTO>> getStepsDay() {
        List<StepsDTO> list =  healthDataService.getStepsDay();
        return Result.success(list);
    }

    /**
     *查询周步数
     */
    @GetMapping("/steps/weekend")
    public Result<List<StepsDTO>> getStepsWeekend() {
        List<StepsDTO> list =  healthDataService.getStepsWeekend();
        return Result.success(list);
    }

    /**
     *查询月步数
     */
    @GetMapping("/steps/month")
    public Result<List<StepsDTO>> getStepsMonth() {
        List<StepsDTO> list =  healthDataService.getStepsMonth();
        return Result.success(list);
    }

    /**
     *查询日心率
     */
    @GetMapping("/heart/day")
    public Result<HeartDTO> getHeartDay() {
        HeartDTO dto =  healthDataService.getHeartDay();
        return Result.success(dto);
    }

    /**
     *查询周心率
     */
    @GetMapping("/heart/weekend")
    public Result<HeartDTO> getHeartWeekend() {
        HeartDTO dto =  healthDataService.getHeartWeekend();
        return Result.success(dto);
    }

    /**
     * 查询月心率
     */
    @GetMapping("/heart/month")
    public Result<HeartDTO> getHeartMonth() {
        HeartDTO dto =  healthDataService.getHeartMonth();
        return Result.success(dto);
    }

    /**
     *查询日血压
     */
    @GetMapping("/blood/day")
    public Result<HeartDTO> getBloodDay() {
        HeartDTO dto =  healthDataService.getBloodDay();
        return Result.success(dto);
    }

    /**
     *查询周血压
     */
    @GetMapping("/blood/weekend")
    public Result<HeartDTO> getBloodWeekend() {
        HeartDTO dto =  healthDataService.getBloodWeekend();
        return Result.success(dto);
    }

    /**
     * 查询月血压
     */
    @GetMapping("/blood/month")
    public Result<HeartDTO> getBloodMonth() {
        HeartDTO dto =  healthDataService.getBloodMonth();
        return Result.success(dto);
    }


}
